import request from './axios'

// 获取用户订单列表
export function getUserOrders(params) {
  return request({
    url: '/api/products/orders/',
    method: 'get',
    params
  })
}

// 创建订单（从购物车结算）
export function createOrder(data) {
  return request({
    url: '/api/products/orders/create/',
    method: 'post',
    data
  })
}

// 获取订单详情
export function getOrderDetail(orderId) {
  return request({
    url: `/api/products/orders/${orderId}/`,
    method: 'get'
  })
}

// 更新订单状态
export function updateOrderStatus(orderId, status) {
  return request({
    url: `/api/products/orders/${orderId}/update/`,
    method: 'patch',
    data: { status }
  })
}